package com.xiaoyu.lanling.feature.chat.activity

import android.content.Intent
import android.os.Bundle
import androidx.annotation.Keep
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.activity.base.AppCompatToolbarActivity
import com.xiaoyu.lanling.feature.chat.contract.ChatContract
import com.xiaoyu.lanling.feature.chat.controller.ChatViewController

@Keep
class ChatActivity : AppCompatToolbarActivity() {

    private var mController: ChatContract.View? = null

    override fun onCreateSafelyAfterAppFinishInit(savedInstanceState: Bundle?) {
        super.onCreateSafelyAfterAppFinishInit(savedInstanceState)
        setLightStatusBar()
        setContentView(R.layout.activity_chat)

        mController = ChatViewController(this)
    }

    override fun onPause() {
        super.onPause()
        mController?.onPause()
    }

    override fun onStop() {
        super.onStop()
        mController?.onStop()
    }

    override fun onDestroy() {
        super.onDestroy()
        mController?.onDestroy()
    }

    override fun onNewIntent(intent: Intent?) {
        super.onNewIntent(intent)
        setIntent(intent)
        intent?.let {
            mController?.onNewIntent(it)
        }
    }

    override fun onBackPressed() {
        if (mController?.onBackPressed() == true) {
            return
        }
        super.onBackPressed()
    }
}